package com.qf.fmall2202.index.controller;

import com.qf.fmall2202.index.service.CategoryService;
import com.qf.fmall2202.index.service.IndexImgService;
import com.qf.fmall2202.product.service.ProductService;
import com.qf.fmall2202.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 商品图片  前端控制器
 * </p>
 *
 * @author 徐英海
 * @since 2022-11-04
 */
@CrossOrigin
@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private IndexImgService indexImgService;
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private ProductService productService;

    @GetMapping("/indeximg")
    public ResultVo indeximg() {
        return indexImgService.queryIndexImg();
    }

    @GetMapping("/category-list")
    public ResultVo categoryList() {
        return categoryService.queryCategoryList();
    }

    @GetMapping("/list-recommends")
    public ResultVo listRecommends() {
        return productService.queryListRecommends();
    }

    @GetMapping("/category-recommends")
    public ResultVo categoryRecommends() {
        return categoryService.queryCategoryRecommends();
    }
}
